package com.atguigu.mybatisplus.controller;


import com.atguigu.mybatisplus.entity.User;
import com.atguigu.mybatisplus.service.UserService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController  //返回JSON数据
@RequestMapping("/user")
@CrossOrigin  //Spring提供的 解决跨域问题
public class UserController {

    @Resource  //获取用户列表  引入Service
    private UserService userService;

    @GetMapping("/list")  //返回 /user/list
    public List<User> list(){
        return userService.list();

    }

}
